//package MountainMq.aop;
//
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.annotation.Pointcut;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.core.annotation.Order;
//import org.springframework.util.StringUtils;
//
//import java.lang.reflect.Field;
//import java.lang.reflect.InvocationHandler;
//import java.lang.reflect.Proxy;
//import java.util.Map;
//
////@Component
////@Aspect
//@Order(-999)
//public class RabbitListenerAop {
//    @Pointcut("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
//    public void pointCut(){
//    }
//
//    @Before("@annotation(rabbitListener)")
//    public void before(RabbitListener rabbitListener) throws Exception{
//        // 反射修改注解中的属性，但是这里并没什么用，因为监听器是项目启动时就根据注解属性初始化好的
//        if(!StringUtils.hasText(rabbitListener.containerFactory())){
//            Class<? extends RabbitListener> listenerClass = rabbitListener.getClass();
//            InvocationHandler h = Proxy.getInvocationHandler(rabbitListener);
//            Field hField  = h.getClass().getDeclaredField("memberValues");
//            hField.setAccessible(true);
//            Map<String, Object> memberValues = (Map) hField.get(h);
//            memberValues.put("containerFactory","commonRabbitListenerContainerFactory");
//            System.out.println();
//        }
//    }
//
//}
